package components.utils;

import java.awt.Component;
import java.util.ArrayList;
import java.util.List;

/**
 * Groups components and allows to enable or disable them at the same time.
 *
 * @author Juan
 */
public class ComponentGroup {
    
    private List<Component> components = new ArrayList<>();
    
    public void addComponent(Component component) {
        components.add(component);
    }
    
    public void removeComponent(Component component) {
        components.remove(component);
    }
    
    public void setEnabled(boolean enabled) {
        for (Component component : components) {
            component.setEnabled(enabled);
        }
    }

}
